# Contributor: rubicon <rubicon@mailo.com>
# Maintainer:
pkgname=ocaml-mew_vi
_pkgname=mew_vi
pkgver=0.5.0
pkgrel=1
pkgdesc="Modal editing witch (VI interpreter)"
url="https://github.com/kandu/mew_vi"
arch="all !riscv64"  # limited by ocaml aport
license="MIT"
depends="ocaml-runtime ocaml-mew ocaml-react"
depends_dev="$pkgname=$pkgver-r$pkgrel ocaml-mew-dev ocaml-react-dev"
makedepends="$depends_dev dune ocaml"
options="!check"    # needs ppx_expect
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/kandu/mew_vi/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	dune build --release --verbose
}

check() {
	dune runtest --verbose
}

package() {
	dune install \
		--destdir="$pkgdir" \
		--docdir=/.omit
	rm -Rf "$pkgdir"/.omit
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
f6ee1375ceee60ccae1799d07a8bc55684fdbffc2275147ef19cf3c7d242663764e6630b9423287a78efacba17f410971e3fc397d202effb331f94dc00797eb0  ocaml-mew_vi-0.5.0.tar.gz
"
